package com.moly.grpc.server;

import com.moly.grpc.routeguide.*;
import io.grpc.stub.StreamObserver;

public class ServerRouteGuideImpl extends RouteGuideGrpc.RouteGuideImplBase {
    @Override
    public void getFeature(Point request, StreamObserver<Feature> responseObserver) {
//        super.getFeature(request, responseObserver);

        int latitude = request.getLatitude();
        int longitude = request.getLongitude();
        System.out.println("latitude  "+latitude);
        System.out.println("longitude  "+longitude);

        Point build = Point.newBuilder().setLatitude(10).setLongitude(100).build();

        responseObserver.onNext(Feature.newBuilder().setName("NMB").setLocation(build).build());
        responseObserver.onCompleted();



    }

    @Override
    public void listFeatures(Rectangle request, StreamObserver<Feature> responseObserver) {
        super.listFeatures(request, responseObserver);
    }

    @Override
    public StreamObserver<Point> recordRoute(StreamObserver<RouteSummary> responseObserver) {
        return super.recordRoute(responseObserver);
    }

    @Override
    public StreamObserver<RouteNote> routeChat(StreamObserver<RouteNote> responseObserver) {
        return super.routeChat(responseObserver);
    }
}
